package com.yanqu.road.entity.messageSubscribe.entity;

import com.yanqu.road.entity.DataObject;

import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description
 * @Author cwq
 * @Data 2023/5/8 20:26
 */
public class MessageSubscribePlayerData extends DataObject {
    private long playerId;

    private String openId = "";

    /**
     * 已经订阅的模板  k: 模板id v:
     */
    private Map<String, MessageSubscribeInfo> subscribedMap = new ConcurrentHashMap<>();

    /**
     * 微信的订阅总开关
     */
    private boolean isSwitch;

    //离线时间，用来判断离线收益
    private long offLineTime;

    // 记录登录的app_ext参数，用于透传给37
    private String appExt = "";

    public long getPlayerId() {
        return playerId;
    }

    public void setPlayerId(long playerId) {
        if (!Objects.equals(this.playerId, playerId)) {
            this.playerId = playerId;
            setUpdateOption();
        }
    }

    public Map<String, MessageSubscribeInfo> getSubscribedMap() {
        return subscribedMap;
    }

    public void setSubscribedMap(Map<String, MessageSubscribeInfo> subscribedMap) {
        this.subscribedMap = subscribedMap;
        setUpdateOption();
    }

    public boolean isSwitch() {
        return isSwitch;
    }

    public void setIsSwitch(boolean aSwitch) {
        if (!Objects.equals(this.isSwitch, aSwitch)) {
            this.isSwitch = aSwitch;
            setUpdateOption();
        }
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        if(!openId.equals(this.openId)){
            this.openId = openId;
            setUpdateOption();
        }
    }

    public void setSwitch(boolean aSwitch) {
        if(aSwitch != this.isSwitch){
            isSwitch = aSwitch;
            setUpdateOption();
        }
    }

    public long getOffLineTime() {
        return offLineTime;
    }

    public void setOffLineTime(long offLineTime) {
        if(offLineTime != this.offLineTime){
            this.offLineTime = offLineTime;
            setUpdateOption();
        }
    }

    public String getAppExt() {
        return appExt;
    }

    public void setAppExt(String appExt) {
        if(!Objects.equals(appExt, this.appExt)){
            this.appExt = appExt;
            setUpdateOption();
        }
    }
}
